emrg: Add e2e tests for daemon evolution_summary (empty/ordered/limit-clamp/corrupt-skip) - #509
Conversation
…-clamp/corrupt-skip)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-231433 (emrg-00c41753, author self-check, 1/3)
Verified the new tests exercise all four claims made in the #502 review: (1) empty logs → graceful empty reply; (2) recent list newest-first with operations/impact round-trip; (3) limit clamped to 20 (25 files + limit=100 → exactly 20); (4) corrupt evolution-*.json skipped without crashing the connection. Harness reuses the existing isolated-tmp _boot_server pattern (real ws, mocked LLM, no real scheduler). Full suite 482 pass; test-only change.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-232009 (emrg-00c41753, 2/3)
Strong addition — evolution_summary (from #502) had zero automated coverage despite my review claiming 'capped at 20, OSError-safe, empty-graceful'. Verified against the harness:
- _boot_server monkeypatches config_dir → tmp, so tmp/logs is the real source — tests are hermetic (no host ~/.emrg coupling, per the #489 lesson)
- Empty → count=0/recent=[]; corrupt file skipped without crash; newest-first ordering via reverse-lexicographic ISO filenames; limit clamped to 20 (25 written → 20 returned)
- count==0 asserted correctly (in-memory evolutions empty in harness — matches daemon semantics: count = len(self.evolutions), recent = log files)
- +83 lines in tests/test_ws_e2e.py only
CI pending — will confirm before merge.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-232437 (emrg-00c41753, 3/3)
Re-verified tests against the daemon implementation (daemon.py:874-907): logs_dir = config_dir()/logs matches the tmp-config harness; reverse-lexicographic sort + slice [:max(1,min(limit,20))] matches the 25-files→20 clamp assertion; JSONDecodeError/OSError skip matches the corrupt-file case; count=len(self.evolutions) matches the in-memory-empty assertion. Hermetic (no host ~/.emrg coupling). CI green, MERGEABLE.
Summary
The
evolution_summarydaemon command (added in #502, rant 21:35 — powers the GUI "recent improvements" list) had zero automated test coverage. Its review claimed "capped at 20, OSError-safe, empty-graceful" but nothing verified those guarantees. This PR adds two end-to-end protocol tests using the existing test_ws_e2e harness (real WebSocket server, isolated tmp config dir).Tests added (tests/test_ws_e2e.py, TestWSEvolutionSummary)
test_evolution_summary_empty_and_with_logs
recent=[],count=0(graceful empty).logs/evolution-*.json), one corrupt JSON → corrupt file is skipped without crashing; result ordered newest-first (reverse-lexicographic = chronological);operations/impactfields round-trip.test_evolution_summary_limit_clamped_to_20
limit: 100→ response returns at most 20 entries, newest first (clamp upper bound).Verification
-k EvolutionSummary).emrg --helpOK.